namespace VantCellTypes {
    export class DateUtil {

        private static InteralConvertToDate(value: any) {
            if (!value) {
                return null;
            }
            if (value instanceof Date) {
                return value;
            }
            const numerValue = Number(value);

            const isOADate = !isNaN(numerValue);

            if (isOADate) {
                return Forguncy.ConvertOADateToDate(numerValue);
            }

            return new Date(value);
        }

        static ConvertToDate(value: any, effectiveValue: any = "Invalid Date") {
            const date = DateUtil.InteralConvertToDate(value);
            const isInvalidDate = !date || !date.getTime();
            return isInvalidDate ? effectiveValue : date;
        }
    }
}